package com.liu.seckill.controller;

import com.liu.seckill.pojo.User;
import com.liu.seckill.rabbitmq.MQSender;
import com.liu.seckill.vo.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName UserController
 * @Author ：name
 * @Date ：2022-02-16 16:56
 * @Description：
 * @Version: 1.0
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private MQSender mqSender;
    /**
      * 用户信息(测试)
      * @param user
      * @return
      */
  @RequestMapping("/info")
  @ResponseBody
  public RespBean info(User user){

   return RespBean.success(user);

  }

    /**
     * 测试发送RabbitMQ消息
     */
    @RequestMapping("/mq")
    @ResponseBody
    public void mq() {
  mqSender.sendA("Hello");
    }


    /**
     * 测试发送RabbitMQ消息directExchange
     */
    @RequestMapping("/mq/direct02")
    @ResponseBody
    public void mq02() {
  mqSender.send02("Hello,Green");
    }

    /**
     * 测试发送RabbitMQ消息
     */
    @RequestMapping("/mq/topic01")
    @ResponseBody
    public void mq01() {
      mqSender.send04("Hello,Red");
    }

  /**
   * 测试发送RabbitMQ消息
   */
  @RequestMapping("/mq/header01")
  @ResponseBody
  public void mq03() {
  mqSender.send05("Hello,header01");
  }

  /**
   * 测试发送RabbitMQ消息
   */
  @RequestMapping("/mq/header02")
  @ResponseBody
  public void mq04() {
  mqSender.send06("Hello,header02");
  }

}
